package site.luojie.business.code.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import site.luojie.business.code.pojo.AuthCode;

/**
 * @author jie.luo
 * @since 2020/9/17
 */
@Mapper
public interface AuthCodeMapper {

    @Insert("INSERT INTO auth_code(email, code, createTime, expireTime) VALUES (#{code.email}, #{code.code}, #{code.createTime}, #{code.expireTime})")
    int insertAuthCode(@Param("code") AuthCode code);


    @Select("select * from auth_code where email = #{email} order by createTime desc limit 1")
    AuthCode selectLastAuthCode(String email);
}
